package create.singletonPattern.Demo01;

/**
 * @ClassName Test
 * @Description 测试类
 * @Author 李明忠
 * @Date 2025/5/8 16:24
 * @Version 1.0
 */
public class Test {
    public static void main(String[] args) {
        Singleton singleton1 = Singleton.getSingleton();
        Singleton singleton2 = Singleton.getSingleton();


        //从始至终对象就只有一份
        System.out.println(singleton1 == singleton2);//true
        System.out.println("singleton1 地址：" + singleton1.hashCode());//189568618
        System.out.println("singleton2 地址：" + singleton2.hashCode());//189568618
    }
}
